From: Florian Müllner Date: Tue, 28 Apr 2026 12:25:44 +0000 (+0200) Subject: workspaceAnimation: Sort existing records when restacking X-Git-Tag: archive/raspbian/50.5-1+rpi1^2~9^2^2~24 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=fe0dadb2288a1b5fbf418c08de83ba57861a4885;p=gnome-shell.git workspaceAnimation: Sort existing records when restacking When restacking, we currently re-filter window actors, then match each to the corresponding record. Instead, sort the existing records according to the new stacking, then iterate over those directly. This reflects more directly that window records are fixed during the transition, and avoids a (harmless) warning in case a window only appeared during the animation and therefore cannot be matched to a record. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/work_items/8881 Part-of: (cherry picked from commit e7e6de300cfb87c0f91738861b545017e5290ef9) --- diff --git a/js/ui/workspaceAnimation.js b/js/ui/workspaceAnimation.js index f7c2f7a3b..844bac451 100644 --- a/js/ui/workspaceAnimation.js +++ b/js/ui/workspaceAnimation.js @@ -123,15 +123,20 @@ class WorkspaceGroup extends BaseWorkspaceGroup { } _syncStacking() { - const windowActors = global.get_window_actors().filter(w => - this._shouldShowWindow(w.meta_window)); + const stackIndeces = new Map( + global.get_window_actors().map((w, i) => [w, i])); + + this._windowRecords.sort((a, b) => { + const seqA = a.windowActor; + const seqB = b.windowActor; + + return stackIndeces.get(seqA) - stackIndeces.get(seqB); + }); let lastRecord; const bottomActor = this._background ?? null; - for (const windowActor of windowActors) { - const record = this._windowRecords.find(r => r.windowActor === windowActor); - + for (const record of this._windowRecords) { this.set_child_above_sibling(record.clone, lastRecord ? lastRecord.clone : bottomActor); lastRecord = record;